package hb.software.score.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.ExampleMatcher;
import org.springframework.data.domain.ExampleMatcher.GenericPropertyMatchers;
import org.springframework.stereotype.Service;

import hb.software.score.dao.*;
import hb.software.score.entity.*;
import hb.software.score.service.*;
import serviceImpl.CommonStudentManagerImpl;

@Service("score")
/*
 * 实现类
 * 
 */
public class ScoreManagerImpl extends CommonStudentManagerImpl<Score, Long> implements ScoreManager {
	
	
	private ScoreDao scoreDao;
	@Override
	public List<Score> findByName(String name) {
		// 创建查询条件数据对象
		Score queryObject = new Score();
		queryObject.setCoursename(name);
		ExampleMatcher matcher = ExampleMatcher.matching() // 构建对象
				.withMatcher("name", GenericPropertyMatchers.startsWith()) // 姓名采用“开始匹配”的方式查询
				.withIgnorePaths("dateCreated", "dateModified"); 
		// 创建实例并查询
		Example<Score> ex = Example.of(queryObject, matcher);
		List<Score> result = dao.findAll(ex);
		return result;
	}

	@Autowired
	public void setScoreDao(ScoreDao scoreDao) {
		this.scoreDao = scoreDao;
		this.dao = this.scoreDao;
	}

	
	}


